<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>订单明细</title>
<%@ include file="/pages/wx/baseHead.jsp"%>

<script type="text/javascript">
function setChangePrice()
{
	var sn = $("#sn").val();
	var weight =$("#changeWeight").val();
	var price = $("#changePrice").val();
	var errorTag = $("#updatePriceErrorDiv");
	if(isNull(weight))
	{
		errorTag.html('请输入重量');
		return;
	}
	if(hasBlank(weight) || isNaN(weight))
	{
		errorTag.html('请输入正确的重量');
		return;
	}
	weight = parseFloat(weight);
	if(weight <= 0)
	{
		errorTag.html('请输入正确的重量');
		return;
	}
	if(weight > 10000)
	{
		errorTag.html('重量请控制在10000以内');
		return;
	}
	
	if(isNull(price))
	{
		errorTag.html('请输入价格');
		return;
	}
	
	if(hasBlank(price) || isNaN(price))
	{
		errorTag.html('请输入正确的价格');
		return;
	}
	price = parseFloat(price);
	if(price <= 0)
	{
		errorTag.html('请输入正确的价格');
		return;
	}
	if(price > 10000)
	{
		errorTag.html('价格请控制在10000以内');
		return;
	}
	hide('.changePrice');
	confirm('提示','确定要修改价格吗？',function(){
		var url = '${urlBasePath}weixin/user/changePrice.do';
		loading('正在计价');
		$.ajax({
			url:url,
			async:true,
			data:{
				sn:sn,
				price:price,
				weight:weight
			},
			success:function(ret){
				unLoading();
				if(ret.code == '0')
				{
					openToast('计价完成');
					$("#amountDiv").html(price.toFixed(2));
					$("#weightDiv").html(weight);
					
				}else
				{
					openDia('提示',ret.msg);
				}
			},
			error:function(){
				unLoading();
				alert('系统错误');
			}
		});
		
	});
}

</script>


</head>
<body>
<input type="hidden" id="sn" value="${obj.sn }">

<div class="bd" id="orderInfo" style="margin-top: 0px;">
    <div class="weui_panel weui_panel_access">
	
	    <div style="position: absolute;right: 10px;top: 100px;z-index: 10;">
	    	<c:forEach var="state" items="${states }">
	          	<c:if test="${state.value == obj.state }">
		                		${state.text }
	            </c:if>
			 </c:forEach>
			 <div>&nbsp;</div>
			 <c:if test="${user.id == obj.expressUserId && obj.payState != '00' }">
				 <a class="weui_btn weui_btn_plain_primary weui_btn_mini " onclick="show('.changePrice');">
	        		改价
	        	</a>
        	</c:if>
		</div>
        <div class="weui_panel_bd">
            <div href="javascript:void(0);" class="weui_media_box weui_media_appmsg form-inline">
                <div class="weui_media_bd">
                    <h4 class="weui_media_title">快递公司：${obj.expCompName }</h4>
                    <p class="weui_media_desc">
                    	<i class="fa fa-male fa-fw"></i>物品信息：${obj.goodsType } <span id="weightDiv">${obj.weight }</span> kg 
                    	&nbsp;
                    	<i class="fa fa-cny fa-fw"></i>保价：
                    	<fmt:formatNumber value="${null == obj.supportValue?0:obj.supportValue }" pattern="#,##0.00"/>元
                    </p>
                    <p class="weui_media_desc"><i class="fa fa-cny fa-fw"></i>实际价格：<span id="amountDiv"><fmt:formatNumber value="${obj.amountExper }" pattern="#,##0.00"/></span>元 &nbsp;</p>
                    <p class="weui_media_desc"><i class="fa fa-th-list fa-fw"></i>订单号：${obj.sn }</p>
                    <p class="weui_media_desc"><i class="fa fa-barcode fa-fw"></i>条形码：<font id="barcodeFont">${obj.barCode }</font></p>
                    <p class="weui_media_desc"><i class="fa fa-reorder fa-fw"></i>快递单：
                    	<font id="expcodeFont">${obj.expressNo }
	                    	<c:if test="${obj.expressNo != null }">
	                    		<a href="http://m.kuaidi100.com/index_all.html?type=${obj.expCompCode }&postid=${obj.expressNo }" style="color: red;"> &nbsp;配送查询</a>
	                    	</c:if>
                    	</font>
                    </p>
                </div>
            </div>
        </div>
        
        
        
        
        <div class="weui_panel_hd" style="font-size: 1.2em;">收件人信息</div>
        <div class="weui_panel_bd">
            <a href="javascript:void(0);" class="weui_media_box weui_media_appmsg form-inline">
                <div class="weui_media_bd">
                    <h4 class="weui_media_title">收件人：${obj.directionName } 
                    	<c:if test="${obj.state == '05'}">
								<font color="red" size="2em;" style="padding-left: 5px;">
								${obj.receiveUserName }(签收)</font>
				         </c:if>
                    </h4>
                    <p class="weui_media_desc"><i class="fa fa-phone fa-fw"></i>电话：${obj.directionPhone }</p>
                    <p class="weui_media_desc"><i class="fa fa-location-arrow fa-fw"></i>地址：${obj.directionAddress }</p>
                </div>
            </a>
        </div>
        
        <div class="weui_panel_hd" style="font-size: 1.2em;">寄件人信息</div>
        <div class="weui_panel_bd">
            <a href="javascript:void(0);" class="weui_media_box weui_media_appmsg form-inline">
                <div class="weui_media_bd">
                    <h4 class="weui_media_title">寄件人：${obj.fromName }</h4>
                    <p class="weui_media_desc"><i class="fa fa-phone fa-fw"></i>电话：${obj.fromPhone }</p>
                    <p class="weui_media_desc"><i class="fa fa-location-arrow fa-fw"></i>地址：${obj.fromAddress }</p>
                </div>
            </a>
        </div>
    </div>
</div>

<!-- 弹出修改价格Div -->
	<div class="weui_dialog_confirm changePrice" style="display: none;">
		   <div class="weui_mask"></div>
		   <div class="weui_dialog">
		       <div class="weui_dialog_hd"><strong class="weui_dialog_title1 weui_dialog_confirm_title">请修改重量以及价格</strong></div>
		       <div class="weui_dialog_bd weui_dialog_confirm_bd">
		       		<div class="form-inline">
		       			重量：
		       			<input class="weui_input" type="text"  style="height: 38px;width:40%;
				       		border: 1px solid #04BE02;border-radius:5px;" id="changeWeight" 
							placeholder="" value="${obj.weight }" /> 单位：公斤kg
					</div>							
					<div class="form-inline" style="margin-top: 2px;">							
						价格：
			       		<input class="weui_input" type="text"  style="height: 38px;width:40%;padding-top:2px;
				       		border: 1px solid #04BE02;border-radius:5px;" id="changePrice"
							placeholder="" /> 单位：元
		       		</div>
		       		<div id="updatePriceErrorDiv" align="center" style="padding-top:12px;color: red;display: block;">&nbsp;</div>
		       </div>
		       <div class="weui_dialog_ft">
		       	   <a href="javascript:hide('.changePrice');" class="weui_btn_dialog default weui_btn_confirm_dialog_cancel">关闭</a>
		           <a href="javascript:setChangePrice();" class="weui_btn_dialog primary weui_btn_confirm_dialog_ok">确定</a>
		       </div>
		      
		   </div>
	</div>
	<!-- 弹出修改价格Div -->


<div class="pop">
    <i class="fa fa-home fa-lg popi"></i>
</div>

<!-- 引入微信样式代码提示工具开始 -->
<%@ include file="/pages/wx/wxClass.jsp"%>
<!-- 引入微信样式代码提示工具结束 -->
<%@ include file="/pages/wx/baseBottom.jsp"%>
</body>
</html>

